import React from 'react'
import * as action from "../action/index.js"
import {useDispatch,useSelector} from "react-redux"
import {useEffect} from "react"
console.log(action,2222);
function Show() {
  let store = useSelector((state)=>{
    return {
      ...state.shopReducer
    }
  })
  let dispatch = useDispatch()
  let fn = ()=>{
    console.log(action.setName(),1111);
     dispatch(action.setName())
  }
  useEffect(()=>{
     dispatch(action.getList())
  },[])
  return (
    <div>
      <button onClick={fn}>点击我修改name</button>
      {
        store.name
      }
      {
        store.arr && store.arr.length ? store.arr.map((item,index)=>{
          return <div key={index}>{item.Name}</div>
        }):''
      }
    </div>
  )
}

export default Show